package com.example.demo.controller;

import com.example.demo.entity.ClazzOption;
import com.example.demo.entity.JobOption;
import com.example.demo.entity.Result;
import com.example.demo.service.Impl.reportServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
public class ReportController {
    @Autowired
    private reportServiceImpl reportService;

    @GetMapping("/report/empJobData")
    public Result getEmpJobData(){
        log.info("统计各类职工数据：");
        JobOption jobOption = reportService.getEmpJobCount();
        return Result.success(jobOption);
    }

    /**
     * 统计员工性别信息
     */
    @GetMapping("/report/empGenderData")
    public Result getEmpGenderData(){
        log.info("统计员工性别信息");
        List<Map> genderList = reportService.getEmpGenderData();
        return Result.success(genderList);
    }

    /**
     * 统计学生学历信息
     */
    @GetMapping("/report/studentDegreeData")
    public Result getStudentDegreeData(){
        log.info("统计学生学历信息");
        List<Map> degreeList = reportService.getStudentDegreeData();
        return Result.success(degreeList);
    }

    /**
     * 统计各班级总人数
     * @return
     */
    @GetMapping("/report/studentCountData")
    public Result getStudentCountData(){
        log.info("统计各班级总人数");
        ClazzOption clazzOption = reportService.getStudentCountData();
        return Result.success(clazzOption);
    }
}
